package com.example.controller;

import com.example.properties.MyProperties1;
import com.example.properties.MyProperties2;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;



@RequestMapping("/properties")
@RestController
@Api(tags = "1.5", description = "配置文件调用", value = "使用spring-boot注解配置文件模块")
public class PropertiesController {
     public  static  final Logger log=LoggerFactory.getLogger(PropertiesController.class);
     private final MyProperties1 myProperties1;
     private final MyProperties2 myProperties2;
    @Autowired
    public PropertiesController(MyProperties1 myProperties1,MyProperties2 myProperties2) {
        this.myProperties1 = myProperties1;
        this.myProperties2 = myProperties2;
    }

    @GetMapping("/1")
    @ApiOperation(value = "配置文件1")
    public MyProperties1 myProperties1(){
        log.info("====================================================");
        log.info(myProperties1.toString());
        log.info("===================================================");
        return  myProperties1;
    }

    @GetMapping("/2")
    @ApiOperation(value = "配置文件2")
    public MyProperties2 myProperties2(){
        log.info("====================================================");
        log.info(myProperties2.toString());
        log.info("===================================================");
        return  myProperties2;
    }
}
